package routes

import (
	"game-server/app/controllers/admin"
	"game-server/app/middleware"
	"game-server/app/services"

	"github.com/gin-gonic/gin"
)

func SetSysUserRoutes(router *gin.RouterGroup) {
	adminRouter := router.Group("/admin")
	{
		//初始化数据方法
		adminRouter.POST("/init", admin.InitData) //done
		// 登录
		adminRouter.POST("/login", admin.Login) //done
		// 需要认证的路由
		authRouter := adminRouter.Group("").Use(middleware.JWTAuth(services.AdminGuardName))
		// authRouter := adminRouter.Group("")
		// authRouter := adminRouter
		{
			// 系统用户管理
			authRouter.POST("/user/create", admin.SysUserCreate) //添加用户  done
			authRouter.POST("/user/list", admin.SysUserList)     //带条件分页查询用户信息  done
			authRouter.GET("/user/info", admin.SysUserInfo)      //获取用户信息  //todo
			//登出
			authRouter.POST("/logout", admin.Logout) //todo
			//更新用户状态
			authRouter.PUT("/user/updateStatus", admin.SysUserUpdateStatus)
			//更新用户
			authRouter.PUT("/user/updateUser", admin.SysUserUpdate) //done
			//根据Id查询用户
			authRouter.GET("/user/:id", admin.SysUserGet) //done
			//根据id删除用户
			authRouter.DELETE("/user/:id", admin.SysUserDelete) //done
		}
	}
}
